Skip to content

Support de l'anglais pour l'interface (i18n fr/en) - #66

Merged
isc merged 12 commits into
mainfrom
claude/english-interface-support-qu6c2i
Jun 15, 2026
Merged

Support de l'anglais pour l'interface (i18n fr/en)#66
isc merged 12 commits into
mainfrom
claude/english-interface-support-qu6c2i

Conversation

@isc

@isc isc commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Objectif

Ajouter le support de l'anglais pour l'interface, en plus du français. Décisions produit retenues en amont :

  • Langue globale (un seul réglage pour toute l'app, pas par profil), persistée dans localStorage (multiplix-lang), défaut = langue du navigateur.
  • Vocal/TTS anglais complet : parsing des nombres parlés, reconnaissance vocale et audio TTS branchés sur la langue.
  • Specs publiques et guide utilisateur restent FR pour l'instant.

Ce que fait cette PR

Infrastructure i18n

  • Nouveau cœur src/i18n/lang.ts (contexte, useLang, useStrings, helpers hors-React getLang/pickStrings) + LangProvider (src/i18n/LangProvider.tsx).
  • Un module de strings par domaine (src/i18n/*.ts), chacun exposant un hook useXStrings() basé sur une table { fr, en } typée (l'anglais doit structurellement matcher le français).

Interface

  • Tous les écrans et composants localisés (onboarding, accueil, séance, récap, progression, badges, règles, espace parent, confidentialité, nouveautés, feedback, astuces).
  • Badges et changelog rendus dépendants de la langue (résolution par id pour les badges déjà gagnés, donc affichés dans la langue active quelle que soit la langue au moment du gain).
  • Landing statique (index.html) bilingue sans charger de JS : texte dual <span data-lang> togglé par CSS sur html[lang], langue fixée avant le 1er paint par l'inline script du <head> (zéro flash). Titre/meta description ajustés pour l'anglais.
  • Sélecteur de langue ajouté dans l'espace parent.

Vocal / audio

  • Parseur de nombres parlés anglais (src/lib/parseEnglishNumber.ts) + dispatcher par langue (parseSpokenNumber.ts).
  • useSpeechRecognition reçoit le bon tag BCP-47 (en-US/fr-FR) selon la langue.
  • useTTS résout l'audio selon la langue : français à la racine de public/audio/tts/, anglais sous public/audio/tts/en/ (mêmes clés). Cache namespacé par langue.
  • scripts/generate-tts.mjs génère désormais les deux langues (TTS_LANGS pour restreindre ; MISTRAL_VOICE_ID_EN pour surcharger la voix anglaise).

⚠️ À faire avant de sortir l'anglais en vocal complet

Les MP3 anglais ne sont pas encore générés (génération = API Mistral Voxtral + secret CI). Tant qu'ils manquent, l'anglais fonctionne au clavier ; la lecture vocale est silencieuse (dégradation gracieuse de useTTS). Lancer le workflow Generate TTS sur cette branche pour peupler public/audio/tts/en/.

Vérifs

  • tsc -b, eslint, vitest (173 tests) et BASE=/ npm run build : ✅ tous verts.
  • Tests existants conservés en français (langue figée dans le setup vitest).

Points laissés volontairement de côté

  • Specs publiques (/specs/) et guide utilisateur (/guide/) restent en français.
  • Manifest PWA : name « Tablito » conservé (neutre) ; la description reste statique (un manifest ne peut pas être par-utilisateur).
  • Format de date EN : en-US/en-GB selon les écrans — à harmoniser si besoin (détail).

https://claude.ai/code/session_01J9j2FSV2ghTMUwgRgusohv


Generated by Claude Code

claude and others added 12 commits June 14, 2026 08:02
- Add fr/en interface language (global, stored in localStorage, default
  from navigator) via a small language context + per-domain string modules.
- Localize every screen and component, the static landing in index.html
  (bilingual via CSS-toggled data-lang spans, no flash), badges, changelog,
  privacy, strategy hints and feedback messages.
- Make voice input language-aware: English spoken-number parser, recognition
  language tag, and English TTS audio under public/audio/tts/en/.
- Add a language switcher in the parent area.
- generate-tts.mjs now produces both languages.

Specs and user guide stay French for now.

https://claude.ai/code/session_01J9j2FSV2ghTMUwgRgusohv
… defs

- Single source of truth for the BCP-47 date locale (localeFor/useLocale in
  lang.ts); removes the en-GB vs en-US drift across screens.
- Remove unused pluralize, subscribeLang and the listener machinery.
- Memoize badge definitions/map per language instead of rebuilding them on
  every per-badge call.

https://claude.ai/code/session_01J9j2FSV2ghTMUwgRgusohv
The English TTS run hit transient 429s on a few files; the script exited 1,
so the workflow's commit step was skipped and all generated files were lost.

- Retry generateAudio with exponential backoff on 429/5xx/network errors.
- Slightly larger inter-call delay.
- Commit step runs with if: always() so successes persist across runs
  (generation is idempotent — a re-run only fills the missing files).

https://claude.ai/code/session_01J9j2FSV2ghTMUwgRgusohv
…metry

Each language now lives under audio/tts/<lang>/ (fr, en). Removes the
root/fr special case in useTTS audioPath and the generation script.

https://claude.ai/code/session_01J9j2FSV2ghTMUwgRgusohv
- Extract makeSpokenNumberParser (src/lib/spokenNumber.ts): the fallback
  grammar (digit/phrase, equality-marker, trailing-token, safe-prefix) lives
  once; fr/en parsers now only declare their word tables, normalize tail and
  markers. Removes the ~120-line KEEP-IN-SYNC duplication.
- Add parseEnglishNumber tests mirroring the French suite (the new parser had
  no coverage). French tests prove the factory preserved behavior.
- useSpeechRecognition: keep the cached recognizer's lang in sync so an
  interface language change actually reaches voice capture.
- Route non-React i18n accessors (badges, strategies, changelog) through the
  documented pickStrings helper instead of open-coding table[getLang()].

https://claude.ai/code/session_01J9j2FSV2ghTMUwgRgusohv
Set VOICE_ID_EN to an English Voxtral voice (overridable via
MISTRAL_VOICE_ID_EN) and drop the en/ MP3s that were generated with the
French voice, so the workflow regenerates them with the correct voice.

https://claude.ai/code/session_01J9j2FSV2ghTMUwgRgusohv
…ace-support-qu6c2i

# Conflicts:
#	index.html
#	src/lib/changelog.ts
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Preview supprimée (PR fermée). Les URLs ne sont plus accessibles.

@isc
isc marked this pull request as ready for review June 15, 2026 12:06
@isc
isc merged commit 44868c0 into main Jun 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants